Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Add site filter to TermsQuery #10131

Merged
merged 2 commits into from
May 28, 2024
Merged

[5.x] Add site filter to TermsQuery #10131

merged 2 commits into from
May 28, 2024

Conversation

arcs-
Copy link
Contributor

@arcs- arcs- commented May 21, 2024

This PR adds the site filter argument on the Graphql TermsQuery. This aligns it with the EntriesQuery and GlobalSetQuery that already had it.

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test to TermsTest.

The equivalent behavior for entries is here:

public function it_queries_all_entries_in_a_specific_site()
{
$this->createEntries();
$this->setSites([
'en' => ['url' => 'http://localhost/', 'locale' => 'en'],
'fr' => ['url' => 'http://localhost/fr/', 'locale' => 'fr'],
]);
Collection::find('events')->routes('/events/{slug}')->sites(['en', 'fr'])->save();
EntryFactory::collection('events')->locale('fr')->origin('4')->id('44')->slug('event-two')->create();
$query = <<<'GQL'
{
entries(site: "fr") {
data {
id
}
}
}
GQL;
$this
->withoutExceptionHandling()
->post('/graphql', ['query' => $query])
->assertGqlOk()
->assertExactJson(['data' => ['entries' => ['data' => [
['id' => '44'],
]]]]);
}

@jasonvarga jasonvarga merged commit d2ae92c into statamic:5.x May 28, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants